<div id="wrapper">
    <div id="page-wrapper">
        <div class="panel panel-primary">
            <div class="panel-heading"><h5 class="panel-title"></h5></div>
            <div class="panel-body">
                <div id="toolbar" class="ms-toolbar">
                    <button id="toolbar-add" class="btn btn-danger" data-toggle="modal" data-target="#myModal">
                        <span class="glyphicon glyphicon-plus"></span> 增加
                    </button>
                </div>
                <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                     aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal"
                                        aria-hidden="true">&times;</button>
                                <h4 class="modal-title" id="myModalLabel">增加广告图片</h4>
                            </div>
                            <div class="modal-body">
                                <form id="addbannerimg" class="form-horizontal" role="form"
                                      enctype="multipart/form-data">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">名称</label>

                                        <div class="col-sm-10">
                                            <input name='ad_name' type="text" class="form-control" placeholder="必填，名称">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">类型</label>

                                        <div class="col-sm-10">
                                            <select id="ad_type" name='ad_type' class="form-control">
                                                <option value="0">商品</option>
                                                <option value="1">帖子</option>
                                                <option value="2">活动</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">位置</label>

                                        <div class="col-sm-10">
                                            <input name='pid' type="text" class="form-control"
                                                   placeholder="必填，请输入正确的广告位置">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">链接</label>

                                        <div class="col-sm-10">
                                            <input name='ad_link' type="text" class="form-control" placeholder="必填">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">展示顺序</label>

                                        <div class="col-sm-10">
                                            <input name='orderby' type="text" class="form-control" placeholder="请使用正整数">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">广告图片</label>

                                        <div class="col-sm-10">
                                            <input id="ad_code_img" name="file" type="file" multiple
                                                   class="file-loading" data-url="">
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="modal-footer">
                                <button id="close" type="button" class="btn btn-primary" data-dismiss="modal">关闭
                                </button>
                                <button id="confirm" type="button" class="btn btn-primary">提交</button>
                            </div>
                        </div>
                    </div>
                    -->
                    <!-- /.modal-dialog -->
                </div>
                <table class="table table-bordered">
                    <thead>
                    <th>ID</th>
                    <th>名称</th>
                    <th>位置ID</th>
                    <th>类型</th>
                    <th>链接</th>
                    <th>排序</th>
                    <th>图片</th>
                    <th>操作</th>
                    </thead>

                    <tbody>
                    {%notempty name="$data"%}
                    {%volist name="$data->all()" id="vo"%}
                    <tr>
                        <td>{%$vo.ad_id%}</td>
                        <td>{%$vo.ad_name%}</td>
                        <td>{%$vo.pid%}</td>
                        <td>
                            {%switch name="$vo.ad_type"%}
                            {%case value="0"%}商品{%/case%}
                            {%case value="1"%}帖子{%/case%}
                            {%case value="2"%}活动{%/case%}
                            {%/switch%}
                        </td>
                        <td>{%$vo.ad_link%}</td>
                        <td>{%$vo.orderby%}</td>
                        <td><a href={%$vo.ad_code%} data-lightbox="{%$vo.ad_id%}">查看</a></td>
                        <td>
                            <button class="btn btn-danger btn-sm delbannerimg" id="{%$vo.ad_id%}">删除</button>
                        </td>
                    </tr>
                    {%/volist%}
                    </tr>
                    </tbody>
                </table>
                <div class="pull-right">
                    {%$data->render()%}
                </div>
                {%/notempty%}
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id='deleteModal' tabindex="-1" role="dialog">
    <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">确认删除</h4>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-dismiss="modal">取消</button>
                <button id="delete_confirm" type="button" class="btn btn-danger">确认</button>
            </div>
        </div>
    </div>
</div>
<script src="/static/home/widget/management/bannerimagelist/bannerimagelist.js"></script>
<script src="/static/home/widget/management/bannerimagelist/delbannerimage.js"></script>
